package edu.gatech.blackjackai.testcases;

import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;

import edu.gatech.blackjackai.carddata.*;

public class DeckTests {

	private Deck dealerDeck;
	private Deck discardDeck;
	private Deck tableDeck;
	private Deck testDeck;
	
	@Before
	public void setUp() throws Exception {
		dealerDeck = new Deck(1); // new 52 card deck
		discardDeck = new Deck(); // new blank deck 
		tableDeck = new Deck();
		testDeck = new Deck(2);
	}

	@Test
	public void deckInitTest1() {
		assertEquals("The DealerDeck failed to be of size 52", 52, dealerDeck.numCards());
	}
	
	@Test
	public void deckInitTest2() {
		assertEquals("The discardDeck failed to be of size 0", 0, discardDeck.numCards());
	}
	
	@Test
	public void deckInitTest3() {
		assertEquals("The tableDeck failed to be of size 0", 0, tableDeck.numCards());
	}
	
	@Test
	public void deckRemoveTest1() {
		assertEquals("There are not 4 sevens in this deck", 4, dealerDeck.numCardType(CardValue.SEVEN));
	}
	
	@Test
	public void deckRemoveTest2() {
		assertEquals("A 7 wasn't removed from the deck", CardValue.SEVEN, dealerDeck.removeCard(CardValue.SEVEN));
		assertEquals("There are not 3 sevens in the deck after one was removed", 3, dealerDeck.numCardType(CardValue.SEVEN));
	}
	
	@Test
	public void deckRemoveTest3() {
		tableDeck.addAll(dealerDeck);
		assertEquals("Table deck doesn't have 52 cards in it", 52, tableDeck.numCards());
	}
	
	@Test
	public void multipleDeckTest1() {
		assertEquals("testDeck doesn't have 104 cards in it", 104, testDeck.numCards());
	}
	
	@Test
	public void multipleDeckTest2() {
		assertEquals("There are not 8 sevens in this deck", 8, testDeck.numCardType(CardValue.SEVEN));
	}

}
